package net.lab1024.sa.admin.module.business.erp.inv.controller;

import net.lab1024.sa.admin.module.business.erp.inv.domain.form.InventordAddForm;
import net.lab1024.sa.admin.module.business.erp.inv.domain.form.InventordQueryForm;
import net.lab1024.sa.admin.module.business.erp.inv.domain.form.InventordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.inv.domain.vo.InventordVO;
import net.lab1024.sa.admin.module.business.erp.inv.service.InventordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 暂收送检单行 Controller
 *
 * @Author AKITA
 * @Date 2025-08-03 22:54:42
 * @Copyright AKITA
 */

@RestController
@Tag(name = "暂收送检单行")
public class InventordController {

    @Resource
    private InventordService inventordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/inventord/queryPage")
    public ResponseDTO<PageResult<InventordVO>> queryPage(@RequestBody @Valid InventordQueryForm queryForm) {
        return ResponseDTO.ok(inventordService.queryPage(queryForm));
    }

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/inventord/queryPageInOut")
    public ResponseDTO<PageResult<InventordVO>> queryPageInOut(@RequestBody @Valid InventordQueryForm queryForm) {
        return ResponseDTO.ok(inventordService.queryPageInOut(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/inventord/add")
    public ResponseDTO<String> add(@RequestBody @Valid InventordAddForm addForm) {
        return inventordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/inventord/update")
    public ResponseDTO<String> update(@RequestBody @Valid InventordUpdateForm updateForm) {
        return inventordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/inventord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return inventordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/inventord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return inventordService.delete(id);
    }
}
